﻿var ProfileSetting = {
    BtnSubmitClick: function () {
        $("#btnSubmit").click(function () {
            var arrayPrivacySetting = new Array();
            $("select[name^=cbFlag_]").each(function () {
                var privacyFlagTypeID = $(this).attr("name");
                privacyFlagTypeID = privacyFlagTypeID.substring(privacyFlagTypeID.indexOf("_") + 1);
                var visibilityLevelID = $(this).val();
                arrayPrivacySetting.push({ PrivacyFlagTypeID: privacyFlagTypeID, VisibilityLevelID: visibilityLevelID });
            });
            $.ajax({
                url: "/Profile/SaveSetting",
                data: $.toJSON(arrayPrivacySetting),
                cache: false,
                dataType: 'json',
                contentType: 'application/json; charset=utf-8',
                type: 'POST',
                success: function (data) {
                    $("#ThongBao").html(data);
                }
            })
        }
        )
    },
    init: function () {
        ProfileSetting.BtnSubmitClick()
    }
}